package com.lrf.eb.service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lrf.eb.mapper.EbProductMapper;
import com.lrf.eb.model.EbProduct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service   //业务层----证
public class EbProductService {
    @Autowired
    EbProductMapper ebProductMapper;






    public Page<EbProduct> page(int psize,int pageSize){
        Page<EbProduct> page= new Page(psize,pageSize);
        Page<EbProduct> productPage = ebProductMapper.selectPage(page,null);
        return productPage;


    }

    public Page<EbProduct> listByCate(int cateId, int psize, int pageSize) {
        Page<EbProduct> page = new Page<>(psize,pageSize);
        Page<EbProduct> productPage =ebProductMapper.selectPage(page,
                Wrappers.<EbProduct>lambdaQuery().eq(EbProduct::getEpcChildId,cateId));
        return productPage;
    }

    public  EbProduct detail(int epId){
        return ebProductMapper.selectById(epId);
    }
}
